﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using eschoolBO;

namespace ESCHOOL.parents
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        attend at = new attend();
        parent par = new parent();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                for (int i = DateTime.Now.Year; i > 1950; i--)
                    ddyear.Items.Add(i.ToString());
            }
        }

        protected void btnview_Click(object sender, EventArgs e)
        {
            DataTable dt=par.GetRecords(Convert.ToInt64(Session["userid"]),"","","","","","","",-99,"",-99,"","",-99,"","",false," and ");
            DataTable dt1 = at.GetAtt(Convert.ToInt64(dt.Rows[0]["student_id"].ToString()), ddyear.SelectedValue.ToString(), false, " and ");
            if (dt1.Rows.Count > 0)
            {
                string a = dt1.Rows[0]["absent"].ToString();
                string p = dt1.Rows[0]["present"].ToString();
                GridView1.DataSource = dt1;
                GridView1.DataBind();
            }
            else
            {
                Label1.Visible = true;
                Label1.Text = "Record not found.";

            }
        }
        public int getabsent(string abs)
        {
            int no;
            if (abs == "")
                no = 0;
            else
                no = Convert.ToInt32(abs.ToString());
            return no;
        }
        public int getpresent(string pre)
        {
            int no;
            if (pre == "")
                no = 0;
            else
                no = Convert.ToInt32(pre.ToString());
            return no;
        }
        public string getMonth(string month)
        {
            int mn = Convert.ToInt32(month);
            string[] arrMonth = { "", "Jan", "Feb", "March", "April", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec" };
            return arrMonth[mn];
        }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        
    }
}
